#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>

using namespace std;

set<int> s;
vector<pair<int,int> > v;
int main(int argc, char **argv){
    int n,tmp;
    scanf("%d",&n);
    s.clear();
    v.clear();
    int head = 1;
    for(int i=1;i<=n;i++){
        scanf("%d",&tmp);
        if(s.count(tmp)){
            s.clear();
            v.push_back(make_pair(head,i));
            head=i+1;
        }else{
            s.insert(tmp);
        }
    }
    if(v.size()){
        printf("%d\n",v.size());

        for(int i=0;i<v.size();i++){
            if(i==v.size()-1)  printf("%d %d\n",v[i].first,n);
            else printf("%d %d\n",v[i].first,v[i].second);

        }
    }else{
        puts("-1");
    }


    return 0;
}
